﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using SureKAM.BackUp.Notify.Common;

namespace SureKAM.BackUp.Notify
{
    class Program
    {
        static void Main(string[] args)
        {
            //FileSystemWatcher watcher=new FileSystemWatcher();
            //watcher.Path = @"\\fs-01\BackUp\Changsha-p-dc";
            //watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName |
            //                       NotifyFilters.DirectoryName;
            //watcher.Filter = "*.txt";

            //watcher.Changed+=new FileSystemEventHandler(onChanged);
            //watcher.Created+=new FileSystemEventHandler(onCreated);
            //watcher.IncludeSubdirectories = true;
            //watcher.EnableRaisingEvents = true;
            //Console.WriteLine("Start");
            //while (Console.Read() != 'q') ;

            Console.WriteLine(Environment.CurrentDirectory.ToString());
            ////获取文件夹详细信息

            DirectoryInfo directoryInfo = new DirectoryInfo(@"\\fs-01\BackUp\Changsha-p-dc");
            try
            {
                if (directoryInfo.Exists)
                {
                    long size=FileCommon.SummaryFilesSize(directoryInfo);
                    Console.WriteLine(size.ToString());
                }
            }
            catch (Exception)
            {
                throw;
            }
            Console.ReadLine();
        }

        private static void onChanged(object source, FileSystemEventArgs e)
        {
            Console.WriteLine("File:" + e.FullPath + "" + e.ChangeType);
        }

        private static void onCreated(object source, FileSystemEventArgs e)
        {
            Console.WriteLine("File:" + e.FullPath + " " + e.ChangeType);
        }
    }
}
